<div class="modal fade select-group-wraper" id="check_pass">
    <div class="modal-dialog dialog-width">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">审核 </h4>
            </div>
            <div class="modal-body body-padding text-center html-body">

                <div class="marginb-10">
                    <lable class="control-lable pull-left">是否需要收费：</lable>
                    <input type="radio" name="fee" class=" " value="1" checked>是 <!--要收费-->
                    <input type="radio" name="fee" class=" " value="2">否 <!--不要收费-->
                </div>
                <div class="marginb-10">
                    <lable class="control-lable pad0 pull-left">会务费：</lable>
                    <input type="text" name="cost" id="cost" class="form-control normalsize" placeholder="会务费~">
                </div>

                <div class="marginb-10">
                    <lable class="control-lable pull-left">是否需要多级审批：</lable>
                    <input type="radio" name="multilevel" class=" " value="1">是 <!--要-->
                    <input type="radio" name="multilevel" class=" " value="2" checked>否 <!--不要-->
                </div>


                <div class="add-list">
                    <div class="marginb-10 clearfix">
                        <label class="control-lable pull-left">一级审批：</label>
                        <select class="form-control width-140 pull-left user_id"  name="department_id" style="margin-right: 10px;" >
                            <option value='0' selected="selected">请选择组织架构</option>
                            <volist name="department" id="vo">
                                <option value="{BEESCRM:$vo.department_id}">{BEESCRM:$vo.department_name}</option>
                            </volist>
                        </select>

                        <!--<select class="form-control width-140 pull-left community_id" >
                            <option value='0' selected="selected">请选择园区</option>
                            <volist name="community" id="vo">
                                <option value="{BEESCRM:$vo.community_id}">444{BEESCRM:$vo.community_name}</option>
                            </volist>
                        </select>-->

                        <span class="add pull-left">添加</span>
                    </div>
                </div>
            </div>
            <div class="modal-footer body-padding">
                <p class="clearfix btn-box">
                    <a type="button" class="btn btn-warning" id="add_submit" data-id=''>确定</a>
                    <a type="button" class="btn btn-primary" data-dismiss="modal">取消</a>
                </p>
            </div>
        </div>
    </div>
</div>

<script>

    $(document).on('click','#add_submit',function(){ //通过审核
        var json={};
        var data={};
        var department = [];

        data.type = 1;
        data.basic_id = $(this).data('id');
        data.fee = $("input[name = fee]:checked").val();
        data.cost = $("#cost").val();

        if(data.fee == 1 && !data.cost) {
            $.alert('error','请输入会务费');
        }

        data.multilevel = $("input[name = multilevel]:checked").val();
console.log(data);
        if(data.multilevel == 1) {
            $("select[name = department_id]").each(function() {
                if($(this).val() == 0) {
                    $.alert('error','请选择相关的组织架构~');return false;
                } else {
                    department.push($(this).val());
                }
            })
        }
        data.department_id = department;
        json.data = data;
        json.url = '/meeting/meeting/appointSetting';
        json.method = 'post';
        json.type = 'json';
        $.getAjax(json,true,reload,'');
        $('#pass_modal').modal('hide');
    });


    $(document).on('click','.check_nopass',function(){ //点击删除按钮
        var json={};
        var data={};
        data.basic_id=$(this).data('id');
        data.type = 2;
        if(!data.basic_id){
            $.alert('error','参数错误,请稍后再试');return;
        }
        $.confirm('你确定审核不通过~',nopass);
        function nopass(){
            json.data=data;
            json.url='/meeting/meeting/appointSetting';
            json.method='post';
            json.type='json';
            $.getAjax(json,true,reload,'');
        }
    });

    $(document).on('click',".check_pass",function() {
        $('#add_submit').attr('data-id',$(this).data('id'));
        $('#check_pass').modal();
    })

    $(document).on('click','.add',function(){
        var level = 2;
        var htmls = "<div class='marginb-10 clearfix'>"+
                "<label class='control-lable pull-left'>" + level + "审批：</label>" +
                "<select class='form-control width-140 pull-left department_id' name='department_id' style='margin-right: 10px;'>"+
                "<option value='0'selected='selected' >请选择组织架构</option>"+
                "<volist name='department' id='vo'>"+
                "<option value='{BEESCRM:$vo.department_id}'>{BEESCRM:$vo.department_name}</option>"+
                "</volist></select>"+
                /*"<select class='form-control width-140 pull-left community_id'>"+
                "<option value='0' selected='selected' >请选择园区</option>"+
                "<volist name='community' id='vo'>"+
                "<option value='{BEESCRM:$vo.community_id}'>{BEESCRM:$vo.community_name}</option>"+
                "</volist>"+
                "</select>*/
                "<span class='pop-delete pull-left'>删除</span></div>";
        $('.add-list').append(htmls);
    });
    $(document).on('click','.pop-delete',function(){
        $(this).parent().remove();
    });
    </script>